package cn.edu.zut.model;

import org.springframework.stereotype.Component;

import java.sql.Date;
import java.text.ParseException;
import java.text.SimpleDateFormat;

@Component
public class Book {
    //id
    private int bookid;
    //ISBN
    private String isbn;
    //类别
    private int typeid;
    //图书名称
    private String bookname;
    //作者
    private String author;
    //出版社
    private String publish;
    //出版日期
    private Date publishdate;
    //印刷次数
    private int publishtime;
    //单价
    private float unitprice;
    //状态
    private int status;

    public Book(){
        publishtime = -1;
        unitprice = -1;
        status = -1;
    }

    public Book(String isbn,int typeid, String bookname,String author,
                String publish,Date publishdate,int publishtime,float unitprice,int status)
    {
        publishtime = -1;
        unitprice = -1;
        status = -1;
    }

    public int getBookid() {
        return bookid;
    }

    public void setBookid(int bookid) {
        this.bookid = bookid;
    }

    public String getIsbn() {
        return isbn;
    }

    public void setIsbn(String isbn) {
        this.isbn = isbn;
    }

    public int getTypeid() {
        return typeid;
    }

    public void setTypeid(int typeid) {
        this.typeid = typeid;
    }

    public String getBookname() {
        return bookname;
    }

    public void setBookname(String bookname) {
        this.bookname = bookname;
    }

    public String getAuthor() {
        return author;
    }

    public void setAuthor(String author) {
        this.author = author;
    }

    public String getPublish() {
        return publish;
    }

    public void setPublish(String publish) {
        this.publish = publish;
    }

    public Date getPublishdate() {
        return publishdate;
    }

    public void setPublishdate(Date publishdate) {
        this.publishdate = publishdate;
    }

    public int getPublishtime() {
        return publishtime;
    }

    public void setPublishtime(int publishtime) {
        this.publishtime = publishtime;
    }

    public float getUnitprice() {
        return unitprice;
    }

    public void setUnitprice(float unitprice) {
        this.unitprice = unitprice;
    }

    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }

    @Override
    public String toString() {
        return "Book{" +
                "bookid=" + bookid +
                ", isbn='" + isbn + '\'' +
                ", typeid=" + typeid +
                ", bookname='" + bookname + '\'' +
                ", author='" + author + '\'' +
                ", publish='" + publish + '\'' +
                ", publishdate=" + publishdate +
                ", publishtime=" + publishtime +
                ", unitprice=" + unitprice +
                ", status=" + status +
                '}';
    }
}
